0 'must add "pmode 0" with mcx basic 3.1
1 'MONSTERS IN THE MANOR (2020)
2 'FOR THE TRS-80 MC-10
3 'PORTIONS BY JIM MCCLELLAN
4 'MAPS DRAWN WITH MCDRAW
5 'intro & end screen graphics
6 'by paul shoemaker
7 '(THANKS, PAUL!)
8 '19-NOV-22 ADDED COMBAT SPEED SELECTION
10 CLS0:PMODE 0:GOSUB 1210:GOSUB 1350
20 FLSH=2:LEVEL=1:HEALTH=125:P$="O3;L15;C;P15;C;L15;C;L5;G":ENC$="L10;O2;D;C#;O1;L5;F#":DEAD$="O1;L10;B;B;B;L5;B;P12;O2;L10;D;D-;D-;O1;B;B;A+;L5;B"
30 K$(1)="\81\83\82\8c\8c\8c\8c"
40 K$(2)="\84\8c\88\8b\8b\8f\87"
50 DIM MN$(20,1),TR$(9),AT$(12),DF(5,1),TR(12,1),RM$(5)
60 FOR I=1 TO 20:READ MN$(I,0),MN$(I,1):NEXT I
70 FOR I=1 TO 5:READ RM$(I):NEXT I:FOR I=1 TO 5:READ DF(I,0),DF(I,1):NEXT I
80 FOR I=1 TO 9:READ TR$(I):NEXT I:FOR I=1 TO 12:READ AT$(I):NEXT I
90 GOSUB 320:GOSUB 820
100 SET(X,Y,2):PRINT@407,"COORDS:";:PRINT@438,X;",";Y;
110 KB=PEEK(17023) AND PEEK(2)
111 IF KB=70 THEN GOSUB 1300
120 IF KB=87 AND POINT(X,Y-1)=0 THEN RESET(X,Y):Y=Y-1:GOSUB 470
130 IF KB=65 AND POINT(X-1,Y)=0 THEN RESET(X,Y):X=X-1:GOSUB 470
140 IF KB=83 AND POINT(X+1,Y)=0 THEN RESET(X,Y):X=X+1:GOSUB 470
150 IF KB=90 AND POINT(X,Y+1)=0 THEN RESET(X,Y):Y=Y+1:GOSUB 470
160 IF X=TR(1,0) AND Y=TR(1,1) THEN PLAY"L20;O3;A;B;C":KEY=-1:TR(1,0)=0:TR(1,1)=0:PRINT@279,K$(1);:PRINT@311,K$(2);
170 IF POINT(X+2,Y)=3 AND KEY=-1 THEN LEVEL=LEVEL+1:FLSH=2:GOSUB 320:GOSUB 820
180 FOR I=2 TO 12:IF TR(I,0)=X AND TR(I,1)=Y THEN TR(I,0)=0:TR(I,1)=0:GOSUB 840:NEXT I ELSE NEXT I
185 IF HEALTH<=0 THEN GOTO 1160
190 GOTO 100
200 DATA"DINGUS",10,"WRETCHED",25,"SLIME MOLD",15
210 DATA"WOOD ELF",10,"BLOBBAGOO",10,"STALKER",25
220 DATA"CRAWLER",30,"RAPSCALLION",20
230 DATA"FLESH EATER",20,"SHADOWBEAST",25,"WRAITH",15
240 DATA"IMP",10,"BLOODFIEND",25,"SOUL REAPER",30
250 DATA"GIANT RAT",10,"WITCHER",25,"GHOST BAT",20
260 DATA"DUNG FUNGUS",10,"TWERP",5,"PLASMAGOG",75
270 DATA"MAIN ENTRANCE","UPSTAIRS LOFT","SANCTUARY","GRAND HALL","MUSEUM"
280 DATA 5,6,5,8,6,10,6,15,6,20
290 DATA"ELIXIR OF HEALING","STAFF OF STRENGTH","HEALING MANA","POTION OF HEALTH","REMOTE VIEWING SPELL","EMPTY CHEST","RATTLESNAKES","RABID MICE","ROTTING CORPSE"
300 DATA"KICK","PUNCH","ELBOW","SLASH","HEADBUTT","CHARGE","TROUNCE","JAB","BASH","PUMMEL","WALLOP","STRIKE"
310 '**** LEVEL LOADER
320 IF LEVEL=6 THEN GOTO 1270
325 X=3:Y=19:KEY=0
330 D$=STR$(LEVEL):D$=RIGHT$(D$,1)
340 LOADM"MAP"+D$+".BIN":PRINT@480,STRING$(31,32);
350 XK=RND(40):YK=RND(29)
360 IF POINT(XK,YK)<>0 THEN GOTO 350
370 TR(1,0)=XK:TR(1,1)=YK
380 FOR I=2 TO 12
390 XK=RND(40):YK=RND(29)
400 IF POINT(XK,YK)<>0 THEN GOTO 390
410 TR(I,0)=XK:TR(I,1)=YK
420 NEXT I
430 'key loc PRINT@87,TR(1,0);",";TR(1,1);
440 E=(29-LEN(RM$(LEVEL)))/2:PRINT@480+E,"*";RM$(LEVEL);"*";
450 '*** REFERENCE PRINT@119,TR(2,0);TR(2,1);:PRINT@151,TR(3,0);TR(3,1);:PRINT@183,TR(4,0);TR(4,1);:PRINT@215,TR(5,0);TR(5,1);:PRINT@247,TR(6,0);TR(6,1);
460 RETURN
465 'monster encounter probab.
466 'data statements in line280
467 'probability,monsters
468 'lower 1st number less chance of encounter
470 SOUND 255,1:MST=RND(100)
480 IF MST < DF(LEVEL,0) THEN GOSUB 500
490 RETURN
500 EN=RND(DF(LEVEL,1)):E$=STRING$(11-LEN(MN$(EN,0))," "):PLAY ENC$
510 PCOPY 0 TO 1:PRINT@85,"*encounter*";
520 PRINT@117,MN$(EN,0);E$;
525 PRINT@149,"STRENGTH:";MN$(EN,1);
530 GOSUB 780
540 PRINT@168,"DO YOU CHOOSE TO...";
550 PRINT@234,"1> RUN AWAY";:PRINT@266,"2> FIGHT!";
560 I$=INKEY$:IF I$<>"1" AND I$<>"2" THEN GOTO 560
570 IF I$="1" THEN GOSUB 740:IF RF<>1 THEN PCOPY 1 TO 0:RETURN
580 IF I$="1" THEN PRINT@360,"YOU CAN'T ESCAPE!"; ELSE PRINT@360,"FIGHT IT IS!";
590 I$=INKEY$:IF I$<>" " THEN GOTO 590
600 GOSUB 780
610 MH=VAL(MN$(EN,1))
620 A=0:A$="PRESS f TO FIGHT!"
630 IF MH<=0 THEN GOSUB 1060:PCOPY 1 TO 0:GOSUB 810:RETURN
635 IF HEALTH<=0 THEN GOTO 1160
640 PRINT@164,MN$(EN,0);":";MH;:PRINT@196,"YOU:";HEALTH;
650 PRINT@233,A$;
660 I$=INKEY$:IF I$<>"F" AND A=0 THEN GOTO 660
670 A=-1:A$="":GOSUB 970
680 GOSUB 780
690 PRINT@260,MN$(EN,0);" ATTACKS!";
700 GOSUB 750
710 IF RF>1 THEN PRINT@292,"BUT MISSES!";:GOSUB 1030
720 IF MH>0 AND RF=1 THEN HP=INT(RND(HEALTH*.25)):PRINT@292,"HITS FOR";HP;"DAMAGE!";:HEALTH=HEALTH-HP:GOSUB 1030
730 GOSUB 780:GOTO 630
740 '*** CHOOSE TO RUN
750 RF=RND(3)
760 RETURN
770 '*** BATTLE/RUN WINDOW
780 FOR I=164 TO 356 STEP 32
790 PRINT@I,STRING$(28," ");
800 NEXT I:RETURN
810 '*** HEALTH DISPLAY
820 PRINT@343,"HEALTH:";:PRINT@375,HEALTH;:GOSUB 1340:RETURN
830 '*** TREASURE FOUND
840 PCOPY 0 TO 1:PLAY"O3;L30;C;F;G;A"
850 GOSUB 780
860 PRINT@165,"*YOU'VE FOUND A CHEST*";
870 PRINT@197,"OPENING IT REVEALS...";
880 C=RND(9)
890 T=(32-LEN(TR$(C)))/2
900 PRINT@224+T,TR$(C);
910 IF C<5 THEN H=10+RND(25):HEALTH=HEALTH+H
920 IF C>6 THEN H=5+RND(10):HEALTH=HEALTH-H
930 IF C=5 AND TR(1,0)<>0 THEN PRINT@297,"KEY AT:";TR(1,0);",";TR(1,1);
940 PRINT@356,"*TAP SPACE TO RETURN*";
950 I$=INKEY$:IF I$<>" " THEN GOTO 950
960 PCOPY 1 TO 0:GOSUB 820:RETURN
970 '*** ATTACK SUB
980 PRINT@260,"YOU ";AT$(RND(12));" THE ";MN$(EN,0);
990 HIT=RND(2)
1000 IF HIT=1 THEN PRINT@292,"BUT MISS!";
1010 IF HIT=2 THEN HP=INT(RND(MH/2)):PRINT@292,MN$(EN,0);" HIT FOR";HP;:MH=MH-HP
1020 GOSUB 1030:RETURN
1030 '*** FIGHT/MSG WAIT
1040 IF SC=0 THEN FOR I=1 TO 1000:NEXT I
1050 RETURN
1060 '*** MONSTER DEFEATED
1070 PRINT@228,MN$(EN,0);" DEFEATED!!";:PLAY P$
1080 PRINT@260,"YOU SEARCH THE ";MN$(EN,0);:PRINT@292,"AND FIND ";
1090 IF TR(1,0)=0 THEN POT=RND(2) ELSE POT=RND(3)
1100 IF POT=1 THEN PRINT "NOTHING.";
1110 IF POT=2 THEN PRINT "HEALING SALVE!";:HEALTH=HEALTH+20
1120 IF POT=3 THEN PRINT"A NOTE THAT SAYS:";:PRINT@324,"KEY AT";TR(1,0);",";TR(1,1); 
1130 PRINT@360,"PRESS SPACE";
1140 I$=INKEY$:IF I$<>" " THEN GOTO 1140
1150 RETURN
1160 '*** player dead
1170 GOSUB 780:PLAY DEAD$
1180 PRINT@197,"** ALAS, YOU HAVE DIED **";
1190 PRINT@229,"RATS GNAW ON YOUR CORPSE.";
1200 GOTO 1200
1210 LOADM"SPLASH.BIN"
1250 I$=INKEY$:IF I$<>CHR$(13) THEN GOTO 1250
1260 CLS:RETURN
1270 '*** end screen
1280 LOADM"FINISH.BIN"
1285 PLAY"L4;O2;C;E;G;O3;L2;C;D"
1290 GOTO 1290
1300 IF FLSH=0 THEN SOUND1,1:RETURN
1305 PCOPY 0 TO 1
1310 FOR I=2 TO 12:IF TR(I,0)<>0AND TR(I,1)<>0 THEN SET(TR(I,0),TR(I,1),2)
1315 NEXT I
1320 FOR J=1 TO 500:NEXT J
1330 PCOPY 1 TO 0:FLSH=FLSH-1
1340 PRINT@470,"FLASH:";FLSH;:RETURN
1350 PRINT"FAST COMBAT MESSAGES? (Y/N)";
1360 I$=INKEY$:IF I$<>"Y" AND I$<>"N" THEN GOTO 1360
1370 IF I$="Y" THEN SC=-1
1380 RETURN
